import request from '@/utils/request'
import axios from 'axios'

export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

export function getInfo() {
  return request({
    url: '/info/detail',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}

export function isExit(username) {
  return axios({
    url: 'http://localhost:8080/info/exit',
    method: 'get',
    params: { username }
  })
}

export function createUser(data) {
  return request({
    url: '/info/create',
    method: 'post',
    data
  })
}

export function updatePwd(data) {
  return request({
    url: '/info/updatePwd',
    method: 'post',
    data
  })
}

export function updateUserProfile(data) {
  return request({
    url: '/info/updateProfile',
    method: 'post',
    data
  })
}
